package gat.api.rest.background.tg;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import gat.domain.service.tg.ReportService;
import gat.dto.req.report.QueryOrderReq;
import gat.dto.res.report.ReportOrderRes;
import lombok.extern.slf4j.Slf4j;

/**
 * 报表数据
 */
@Slf4j
@SuppressWarnings("unchecked")
@RestController
@RequestMapping("/index")
public class IndexApiController {

    @Autowired
    private ReportService reportService;

    /**
     * 概览
     */
    @PostMapping("/overview")
    ReportOrderRes overview(@RequestBody QueryOrderReq params) {
        return reportService.overview(params);
    }

    /**
     * 按天分
     */
    @PostMapping("/daily")
    Map<String, ReportOrderRes> daily(@RequestBody QueryOrderReq params) {
        return reportService.queryDaily(params);
    }

    /**
     * 按机器人分
     */
    @PostMapping("/queryBot")
    Map<String, ReportOrderRes> queryBot(@RequestBody QueryOrderReq params) {
        return reportService.queryBot(params);
    }

    /**
     * 按照厂商
     */
    @PostMapping("/querySupplier")
    Map<String, ReportOrderRes> querySupplier(@RequestBody QueryOrderReq params) {
        return reportService.querySupplier(params);
    }
}
